package javaBase.nowcoder.HJ33_A_整数与IP地址间的转换;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
https://www.nowcoder.com/practice/66ca0e28f90c42a196afd78cc9c496ea?tpId=37&rp=1&ru=%2Fexam%2Foj%2Fta&qru=%2Fexam%2Foj%2Fta&sourceUrl=%2Fexam%2Foj%2Fta%3FjudgeStatus%3D3%26page%3D1%26pageSize%3D50%26search%3D%26tpId%3D37%26type%3D37&difficulty=3&judgeStatus=1&tags=&title=&gioEnter=menu
* */
public class Main {
    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String num = br.readLine();
        Long l = Long.parseLong(num);
        String ss[] = s.split("\\.");
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < ss.length; i++) {

            String s0 = "00000000" + Long.toBinaryString(Long.parseLong(ss[i]));
            s0 = s0.substring(s0.length() - 8);
            sb.append(s0);
        }
        Long.parseLong(sb.toString(), 2);
        System.out.println(Long.parseLong(sb.toString(), 2));
        String s1 = Long.toBinaryString(l);
        s1 = "00000000000000000000000000000000" + s1;
        s1 = s1.substring(s1.length() - 32);
        StringBuilder sb1 = new StringBuilder();
        StringBuilder sb2 = new StringBuilder();
        for (int i = 0; i < s1.length(); i++) {
            sb1.append(s1.charAt(i));
            if ((i + 1) % 8 == 0) {
                sb2.append(Long.parseLong(sb1.toString(), 2)).append(".");
                sb1 = new StringBuilder();
            }


        }
        System.out.println(sb2.substring(0, sb2.lastIndexOf(".")));

    }
}
//10.0.3.193
//167969729